﻿@using Equation.Enterprise.Framework.Web.Model
@using ENail.Portal.Web.Models
@using MvcContrib.UI.Pager
@using MvcContrib.UI.Grid 
@using MvcContrib.Pagination 
@model GenericListViewModel<RegistrationListViewItem>

@{
    ViewBag.Title = "Registration List";
    Layout = "~/Views/Shared/_Layout.cshtml";
}


<div id="content">
    @using (Html.BeginForm())
    {
    <table>
        <tr>
            <td><input type="button" value="Add new registration" onclick="document.location='@Url.Action("Add")'" /></td>
            <td align="right" width="150px">Customer Name:</td>
            <td>@Html.TextBoxFor(x => x.Filter)</td>
            <td><input type="submit" value="Search" /></td>
        </tr>
    </table>

    <table>
        <tr>
            <td align="right">
                @Html.Pager((IPagination)Model.List).Link(page => Url.Action("List", new { page = page, filter = Model.Filter }))
            </td>
        </tr>
        <tr>
            <td>
                @Html.Grid(Model.List).Columns((column) =>
                                                {
                                                    column.For(x => Html.CheckBox("chkIsSelected", x.IsSelected))
                                                            .Named("");
                                                    column.For(x => x.CustomerName)
                                                            .Named("First Name")
                                                            .Attributes(width => "200px");
                                                    //column.For(x => x.CustomerLastName)
                                                    //        .Named("Last Name")
                                                    //        .Attributes(width => "200px");
                                                    column.For(x => x.Status)
                                                            .Named("Status")
                                                            .Attributes(width => "150px");
                                                    column.For(x => x.StartTime)
                                                            .Named("Start Time")
                                                            .Attributes(width => "150px")
                                                            .Format("{00:00:00}");
                                                }
                                        ).Attributes(@class => "grid"
                                        ).HeaderRowAttributes(new Dictionary<string, object> { { "class", "gridheaderrow" } }
                                        ).RowAttributes(row => new Dictionary<string, object> { { "onclick", "document.location='" + Url.Action("Update", new { Id = row.Item.Id }) + "'"} })

            </td>
        </tr>
        <tr>
            <td align="right">

            </td>
        </tr>
    </table>
    }
</div>
